﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace nGSO.Config
{
    public class OptimizationTaskConfig
    {
        private static OptimizationTaskConfig _instance;
   
        public static  IDictionary<string, OptimizationTaskElement> Tasks
        {
            get
            {
                return _instances;
            }
        }

        protected static Dictionary<string, OptimizationTaskElement> _instances;

        static OptimizationTaskConfig()
        {
            _instance = new OptimizationTaskConfig();  
            LoadElements();
        }

        private static void LoadElements()
        {
            _instances = new Dictionary<string, OptimizationTaskElement>();
            OptimizationTasksSection sec = (OptimizationTasksSection)ConfigurationManager.GetSection("optimizationTasks");

            foreach (OptimizationTaskElement element in sec.Instances)
            {
                _instances.Add(element.Name, element);
            }
        }

        private OptimizationTaskConfig()
        {

        }
    }
}
